/* Flow Builder - Main CSS */

:root {
  /* Color palette */
  --bg-dark: #121212;
  --bg-darker: #0f0f0f;
  --bg-lighter: #1e1e1e;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-hover: #059669;
  --warning: #f59e0b;
  --danger: #ef4444;
  --surface: #262626;
  --surface-hover: #303030;
  --border: #404040;
  --card-bg: #1a1a1a;
}

/* Base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-darker);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.add-btn {
  background-color: transparent;
  color: var(--primary);
  border: none;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s ease;
}

.add-btn:hover {
  color: var(--primary-hover);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-card, .tool-card, .io-card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  cursor: grab;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.agent-card:hover, .tool-card:hover, .io-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background-color: var(--surface);
}

.agent-card:active, .tool-card:active, .io-card:active {
  cursor: grabbing;
}

.card-icon {
  width: 36px;
  height: 36px;
  background-color: var(--surface);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: var(--primary);
  font-size: 18px;
}

.agent-card .card-icon {
  color: var(--primary);
}

.tool-card .card-icon {
  color: var(--success);
}

.io-card .card-icon {
  color: var(--warning);
}

.card-content h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.card-content p {
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-footer {
  padding: 20px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.toolbar {
  height: 60px;
  background-color: var(--bg-darker);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.left-tools, .right-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider {
  height: 24px;
  width: 1px;
  background-color: var(--border);
  margin: 0 8px;
}

.tool-btn {
  background-color: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background-color: var(--surface);
  color: var(--text-primary);
}

.center-tools {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.network-name {
  font-size: 15px;
  font-weight: 500;
}

.canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.canvas {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  position: relative;
}

/* Canvas Controls */
#canvas-controls {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  gap: 12px;
  z-index: 100;
  align-items: center;
  filter: drop-shadow(0 4px 20px rgba(0, 0, 0, 0.4));
}

.control-group {
  display: flex;
  gap: 12px;
  background-color: rgba(18, 18, 18, 0.75);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(64, 64, 64, 0.35);
  transition: all 0.3s ease;
}

.control-group:hover {
  background-color: rgba(18, 18, 18, 0.85);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(64, 64, 64, 0.5);
}

.control-group.primary {
  background-color: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(64, 64, 64, 0.5);
  padding: 12px 14px;
}

.control-btn {
  border-radius: 50%;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.control-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.control-btn:hover::after {
  opacity: 1;
}

.control-btn:active {
  transform: scale(0.95) !important;
  transition-duration: 0.1s;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.control-btn.save-btn, .control-btn.run-btn {
  width: 52px;
  height: 52px;
  font-size: 20px;
}

.control-btn.zoom-btn {
  width: 44px;
  height: 44px;
  font-size: 16px;
  background-color: rgba(38, 38, 38, 0.95);
  color: var(--text-primary);
  border: 1px solid rgba(64, 64, 64, 0.5);
}

.control-btn.zoom-btn:hover {
  background-color: var(--surface-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  color: var(--primary);
  animation: pulse-zoom 2.5s infinite;
}

@keyframes pulse-zoom {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.control-btn.save-btn {
  background-color: var(--primary);
}

.control-btn.save-btn:hover {
  background-color: var(--primary-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
  animation: pulse-save 2s infinite;
}

.control-btn.save-btn.save-success {
  background-color: var(--success);
  animation: save-success-animation 1.5s cubic-bezier(0.22, 1, 0.36, 1);
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

@keyframes save-success-animation {
  0% {
    transform: scale(1);
    background-color: var(--primary);
  }
  15% {
    transform: scale(1.15);
    background-color: var(--success);
  }
  30% {
    transform: scale(1.08);
    background-color: var(--success);
  }
  100% {
    transform: scale(1);
    background-color: var(--primary);
  }
}

@keyframes pulse-save {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.control-btn.run-btn {
  background-color: var(--success);
}

.control-btn.run-btn:hover {
  background-color: var(--success-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
  animation: pulse-run 2s infinite;
}

@keyframes pulse-run {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Help Text */
.help-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  color: var(--text-secondary);
  pointer-events: none;
}

.help-text i {
  font-size: 24px;
  transform: rotate(-45deg);
  color: var(--primary);
}

.help-text p {
  font-size: 15px;
  text-align: center;
  max-width: 300px;
}

/* Nodes */
.node {
  position: absolute;
  min-width: 200px;
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  user-select: none;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  cursor: move;
}

.node:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.node.selected {
  box-shadow: 0 0 0 2px var(--primary), 0 8px 20px rgba(0, 0, 0, 0.4);
}

.node-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.node.agent .node-header {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.node.tool .node-header {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.node.router .node-header {
  background-color: rgba(139, 92, 246, 0.1); /* Purple tint */
  color: #8b5cf6; /* Purple */
}

.node.input .node-header {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.node.output .node-header {
  background-color: rgba(64, 64, 64, 0.5);
  color: var(--text-secondary);
}

.node-title {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.node-title i {
  font-size: 14px;
}

.node-actions {
  display: flex;
  gap: 6px;
}

.node-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.node-btn:hover {
  background-color: var(--surface);
  color: var(--text-primary);
}

.node-content {
  padding: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.node-badge {
  display: inline-block;
  padding: 2px 6px;
  background-color: var(--surface);
  border-radius: 4px;
  font-size: 12px;
  margin-top: 8px;
  margin-right: 5px;
}

.agent-model {
  color: var(--primary);
}

.router-strategy {
  color: #8b5cf6; /* Purple */
}

/* Router specific styles */
.node.router .output-ports-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-port-container {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.add-port-btn {
  background-color: transparent;
  border: 1px dashed #8b5cf6;
  border-radius: 4px;
  padding: 4px 8px;
  color: #8b5cf6;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.add-port-btn:hover {
  background-color: rgba(139, 92, 246, 0.1);
}

.add-port-btn i {
  font-size: 14px;
}

/* Pattern rows for router config */
.pattern-row, .mapping-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pattern-row .pattern-input,
.mapping-row .content-type-input {
  flex: 2;
}

.pattern-row .port-select,
.mapping-row .port-select {
  flex: 1;
}

.pattern-row .remove-pattern-btn,
.mapping-row .remove-mapping-btn {
  background-color: var(--danger);
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 12px;
}

.weight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.weight-row label {
  flex: 1;
}

.weight-row .weight-input {
  flex: 1;
  max-width: 80px;
}

/* Connection port number */
.port-number-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.router-strategy {
  color: #8b5cf6; /* Purple */
}

/* Router specific styles */
.node.router .output-ports-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-port-container {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.add-port-btn {
  background-color: transparent;
  border: 1px dashed #8b5cf6;
  border-radius: 4px;
  padding: 4px 8px;
  color: #8b5cf6;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.add-port-btn:hover {
  background-color: rgba(139, 92, 246, 0.1);
}

.add-port-btn i {
  font-size: 14px;
}

/* Pattern rows for router config */
.pattern-row, .mapping-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pattern-row .pattern-input,
.mapping-row .content-type-input {
  flex: 2;
}

.pattern-row .port-select,
.mapping-row .port-select {
  flex: 1;
}

.pattern-row .remove-pattern-btn,
.mapping-row .remove-mapping-btn {
  background-color: var(--danger);
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 12px;
}

.weight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.weight-row label {
  flex: 1;
}

.weight-row .weight-input {
  flex: 1;
  max-width: 80px;
}

/* Connection port number */
.port-number-text {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
}

.node-ports {
  padding: 12px;
  display: flex;
  justify-content: space-between;
}

.input-port, .output-port {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Special positioning for I/O nodes */
.node.input .node-ports {
  display: flex;
  justify-content: flex-end;
}

.node.input .output-port {
  flex-direction: row;
  align-items: center;
}

.node.input .port-label {
  margin-top: 0;
  margin-right: 8px;
}

.node.output .node-ports {
  display: flex;
  justify-content: flex-start;
}

.node.output .input-port {
  flex-direction: row;
  align-items: center;
}

.node.output .port-label {
  margin-top: 0;
  margin-left: 8px;
  order: 2;
}

.port {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--card-bg);
  transition: all 0.2s ease;
}

.port-left {
  background-color: var(--primary);
  margin-right: 8px;
}

.port-right {
  background-color: var(--success);
  margin-left: 8px;
}

.port:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.port-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Connections */
/* Connection path and hitbox separation for better UX */
.connection {
  position: relative;
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5px; /* Back to original thin stroke */
  stroke-dasharray: 6 3;
  animation: flow 30s linear infinite;
  /* Special behavior to create invisible wide hitbox */
  paint-order: stroke;
  stroke-opacity: 0.9;
  /* Maintain pointer-events for good hover detection */
  pointer-events: stroke;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

/* Wider invisible hitbox for more forgiving hover detection */
.connection-hitbox {
  pointer-events: all;
  stroke: transparent;
  stroke-width: 20px; /* Wider buffer for more reliable hovering */
  fill: none;
}

@keyframes flow {
  to {
    stroke-dashoffset: -1000;
  }
}

.connection:hover {
  stroke-width: 3px;
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.4));
}

.connection.selected {
  stroke-width: 3.5px;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
  stroke: #4f86f7; /* Slightly lighter blue for better visibility */
}

.connection-highlight {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 99;
}

.temp-connection {
  stroke: var(--primary);
  stroke-width: 3px;
  stroke-dasharray: 6 4;
  pointer-events: none;
  opacity: 0.8;
}

/* Configuration Panel */
.config-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background-color: var(--bg-lighter);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
}

.config-panel.open {
  transform: translateX(0);
}

.panel-header {
  height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 500;
}

.close-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background-color: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background-color: var(--surface);
  color: var(--text-primary);
}

.panel-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.config-section {
  margin-bottom: 24px;
}

.config-section-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.form-control::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.agent-specific-config, .strategy-specific-config {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.panel-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Buttons */
.primary-btn, .secondary-btn, .success-btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary-btn {
  background-color: var(--primary);
  color: white;
  border: none;
}

.primary-btn:hover {
  background-color: var(--primary-hover);
}

.secondary-btn {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  background-color: var(--surface);
}

.success-btn {
  background-color: var(--success);
  color: white;
  border: none;
}

.success-btn:hover {
  background-color: var(--success-hover);
}

.small-btn {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.small-btn:hover {
  background-color: var(--surface-hover);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 450px;
  max-width: calc(100vw - 40px);
  background-color: var(--bg-lighter);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 500;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Connection tooltip */
.connection-tooltip {
  position: absolute;
  background-color: var(--bg-lighter);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 50;
}

.connection-tooltip p {
  margin: 0;
  white-space: nowrap;
}

/* Connection delete button */
.connection-delete-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%; /* Make it circular */
  background-color: rgba(239, 68, 68, 0.85);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(239, 68, 68, 0.4);
  transition: all 0.15s ease-out; /* Smoother, more immediate transition */
  backdrop-filter: blur(4px);
  font-size: 14px;
  z-index: 1000;
  opacity: 0.9; /* Slightly transparent by default */
  pointer-events: all;
}

.connection-delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.95);
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.4), 0 0 0 1px rgba(239, 68, 68, 0.6);
  opacity: 1;
}

.connection-delete-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
  transition: all 0.1s ease;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Connection action menu */
.connection-actions {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(30, 30, 30, 0.9);
  padding: 6px;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(64, 64, 64, 0.4);
  z-index: 1000;
  animation: fadeInScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.connection-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.connection-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.connection-delete-action {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.connection-delete-action:hover {
  background-color: rgba(239, 68, 68, 0.25);
  color: white;
}

.connection-info-action {
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.connection-info-action:hover {
  background-color: rgba(59, 130, 246, 0.25);
  color: white;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--surface-hover);
}

/* Execution Dialog Styles */
.execution-dialog-content {
  width: 700px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.execution-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 15px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
}

.tab-content {
  display: block;
  transition: all 0.3s ease;
}

.tab-content.hidden {
  display: none;
}

/* Input Tab */
#user-input {
  height: 120px;
  resize: vertical;
  font-family: 'Inter', sans-serif;
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 6px;
}

/* Execution Tab */
.execution-status {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background-color: rgba(18, 18, 18, 0.7);
}

.status-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
}

.status-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  margin-right: 10px;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.status-badge.pending {
  background-color: rgba(64, 64, 64, 0.5);
  color: var(--text-secondary);
}

.status-badge.running {
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.status-badge.completed {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.status-badge.error {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.execution-log {
  padding: 16px;
  background-color: var(--bg-darker);
}

.log-container {
  height: 200px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 4px;
  background-color: var(--bg-dark);
}

.log-entry {
  margin-bottom: 4px;
  padding: 2px 0;
}

.log-entry.error {
  color: var(--danger);
}

.log-entry.warning {
  color: var(--warning);
}

.log-time {
  color: var(--text-secondary);
  opacity: 0.7;
  margin-right: 8px;
}

/* Output Tab */
.output-container {
  height: 250px;
  overflow-y: auto;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.output-content {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.output-content.error {
  color: var(--warning);
}

.placeholder-text {
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.7;
  text-align: center;
  padding: 40px 0;
}

/* Execution mode selector */
.execution-mode-selector {
  margin-top: 12px;
}

.radio-group {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.radio-option input {
  accent-color: var(--primary);
}

.radio-option:hover {
  color: var(--text-primary);
}

/* Network Selection UI */
.networks-selection {
  background-color: var(--bg-lighter);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.selection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.selection-header h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.execution-mode {
  display: flex;
  align-items: center;
  gap: 15px;
}

.mode-selector {
  display: flex;
  align-items: center;
  gap: 15px;
}

.mode-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.mode-toggle {
  display: flex;
  background-color: var(--surface);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-container, .mode-buttons {
  display: flex;
  background-color: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.toggle-container input[type="radio"],
.mode-buttons input[type="radio"] {
  display: none;
}

.toggle-container label,
.mode-buttons .mode-btn {
  padding: 8px 15px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  background: none;
  border: none;
}

.toggle-container input[type="radio"]:checked + label,
.mode-buttons .mode-btn.active {
  background-color: var(--primary);
  color: white;
  font-weight: 500;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.network-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  margin-right: 12px;
}

.network-info {
  flex: 1;
}

.network-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.network-stats {
  display: flex;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
}

.network-select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.network-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 350px;
  overflow-y: auto;
  padding: 10px 5px;
  background-color: var(--bg-darker);
  border-radius: 8px;
  margin-bottom: 20px;
}

.network-item {
  background-color: var(--surface);
  border-radius: 8px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid transparent;
  transition: all 0.2s;
  margin-bottom: 10px;
  cursor: pointer;
}

.network-item:hover {
  background-color: var(--surface-hover);
}

.network-item.selected {
  border-color: var(--primary);
  background-color: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 0 1px var(--primary);
}

.network-item.invalid {
  border-color: var(--danger);
  background-color: rgba(239, 68, 68, 0.1);
}

.network-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.network-title i {
  color: var(--primary);
}

.network-details {
  display: flex;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  margin-right: 10px;
}

.network-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.network-checkbox {
  accent-color: var(--primary);
}

.network-actions label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.network-actions button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: all 0.2s;
}

.network-actions button:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.network-actions button:disabled {
  color: var(--text-secondary);
  cursor: not-allowed;
}

.network-mode-explanation {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.network-mode-explanation h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.mode-description {
  margin-bottom: 10px;
  padding: 10px;
  background-color: var(--surface);
  border-radius: 6px;
}

.mode-description h5 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 5px;
  color: var(--primary);
}

.mode-description p {
  font-size: 13px;
  color: var(--text-secondary);
}

.no-networks-message {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* Multi-network result styling */
.multi-network-results {
  margin-bottom: 20px;
}

.network-execution-summary {
  background-color: var(--card-bg);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.network-execution-summary h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.summary-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.network-result-item {
  background-color: var(--card-bg);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-left: 3px solid var(--primary);
}

.network-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.network-result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.network-result-title i {
  color: var(--primary);
}

.network-result-time {
  color: var(--text-secondary);
  font-size: 13px;
}

.network-result-content {
  background-color: var(--surface);
  border-radius: 4px;
  padding: 12px;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
}

.network-result-error {
  color: var(--danger);
  background-color: rgba(239, 68, 68, 0.1);
  border-radius: 4px;
  padding: 12px;
  font-size: 14px;
}

.final-result {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.final-result h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--primary);
}

/* End of network styling */

.network-result-content {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 12px;
  font-size: 13px;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 10px;
}

.network-result-error {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 8px;
  font-size: 13px;
}

.execution-progress {
  flex: 1;
  padding-right: 20px;
}

.progress-bar {
  height: 4px;
  width: 100%;
  background-color: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

/* Advanced feature showcase styles */
.feature-showcase {
  position: relative;
  overflow: hidden;
  cursor: default !important;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.feature-showcase::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(18, 18, 18, 0.7), rgba(30, 30, 30, 0.8));
  backdrop-filter: blur(2px);
  z-index: 5;
  border-radius: 7px;
}

.feature-showcase::after {
  content: "";
  position: absolute;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  top: 0;
  left: -100%;
  animation: shineEffect 4s infinite;
  z-index: 6;
}

@keyframes shineEffect {
  0% {
    transform: translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.1;
  }
  20% {
    opacity: 0;
  }
  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}

.feature-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: rgba(255, 255, 255, 0.9);
  font-size: 9px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
}

.feature-badge::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%233b82f6'%3E%3Cpath fill-rule='evenodd' d='M10 2a8 8 0 100 16 8 8 0 000-16zm0 15a7 7 0 100-14 7 7 0 000 14z' clip-rule='evenodd'/%3E%3Cpath fill-rule='evenodd' d='M10 5a1 1 0 011 1v3.586l2.707 2.707a1 1 0 01-1.414 1.414l-3-3A1 1 0 019 10V6a1 1 0 011-1z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 0 2px rgba(59, 130, 246, 0.5));
  opacity: 0.9;
  animation: pulseEffect 2s infinite;
}

@keyframes pulseEffect {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 5px rgba(59, 130, 246, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.feature-showcase .card-icon {
  position: relative;
  filter: saturate(0.6) brightness(0.85);
  transition: all 0.3s ease;
}

.feature-showcase .card-content h3 {
  position: relative;
  z-index: 7;
}

.feature-showcase .card-content p {
  position: relative;
  z-index: 7;
}

.feature-showcase:hover {
  transform: translateY(-2px);
}

/* Notifications */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
  max-width: 360px;
  pointer-events: none; /* Allow clicks to pass through container */
}

.notification {
  display: flex;
  align-items: center;
  background-color: rgba(18, 18, 18, 0.92);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(10px);
  border-left: 3px solid var(--primary);
  pointer-events: auto; /* Restore pointer events for the notification itself */
  transform-origin: right center;
}

.notification.closing {
  animation: slideOut 0.3s ease forwards;
}

.notification.success {
  border-left-color: var(--success);
}

.notification.warning {
  border-left-color: var(--warning);
}

.notification.error {
  border-left-color: var(--danger);
}

.notification-icon {
  margin-right: 14px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.notification.info .notification-icon {
  color: var(--primary);
  background-color: rgba(59, 130, 246, 0.15);
}

.notification.success .notification-icon {
  color: var(--success);
  background-color: rgba(16, 185, 129, 0.15);
}

.notification.warning .notification-icon {
  color: var(--warning);
  background-color: rgba(245, 158, 11, 0.15);
}

.notification.error .notification-icon {
  color: var(--danger);
  background-color: rgba(239, 68, 68, 0.15);
}

.notification-content {
  flex: 1;
  padding-right: 8px;
}

.notification-content p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.notification-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 16px;
  width: 24px;
  height: 24px;
  padding: 0;
  margin-left: 12px;
  transition: all 0.2s ease;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-close:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0;
    scale: 0.9;
  }
  to {
    transform: translateX(0);
    opacity: 1;
    scale: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
    scale: 1;
  }
  to {
    transform: translateX(30px);
    opacity: 0;
    scale: 0.9;
  }
}

/* Util classes */
.text-primary {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

/* Modern Router UI Styles */
/* Complete redesign of router patterns for a premium look and feel */
.router-pattern-section {
  margin-top: 30px;
  position: relative;
}

.keyword-pattern-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  background-color: rgba(30, 30, 30, 0.5);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(139, 92, 246, 0.15);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(5px);
  flex-wrap: wrap;
}

.keyword-pattern-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: linear-gradient(to bottom, #8b5cf6, #6366f1);
  opacity: 0.6;
  transition: all 0.3s ease;
  border-radius: 4px 0 0 4px;
}

.keyword-pattern-row:hover {
  background-color: rgba(38, 38, 38, 0.6);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.keyword-pattern-row:hover::before {
  opacity: 1;
  width: 6px;
}

/* Pattern row main container - wider to accommodate pattern type */
.pattern-fields-container {
  display: flex;
  gap: 10px;
  flex: 1;
  align-items: center;
  min-width: 100px;
  height: 40px !important;
  margin: 0;
}

/* Pattern type dropdown */
.pattern-type-select {
  background-color: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  color: #a78bfa;
  padding: 4px 10px;
  width: 110px;
  height: 34px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.pattern-type-select:hover, .pattern-type-select:focus {
  background-color: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
  outline: none;
}

/* Keyword input styling */
.keyword-pattern-row input.pattern-input {
  background-color: rgba(12, 12, 12, 0.5);
  border: 1px solid rgba(64, 64, 64, 0.4);
  color: white;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-family: 'Roboto Mono', monospace;
  letter-spacing: 0.02em;
  flex: 1;
  min-width: 100px;
  height: 34px !important;
  transition: all 0.25s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.keyword-pattern-row input.pattern-input:focus {
  border-color: #8b5cf6;
  background-color: rgba(12, 12, 12, 0.8);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.1);
  outline: none;
}

.keyword-pattern-row input.pattern-input::placeholder {
  color: rgba(160, 160, 160, 0.6);
  font-style: italic;
}

/* Special pattern indicators for visual feedback */
.keyword-pattern-row[data-pattern-type="contains"] input.pattern-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 1a.5.5 0 0 0-.5.5v13a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-13a.5.5 0 0 0-.5-.5h-13zm2.207 7.5l3.197 3.196a.5.5 0 0 0 .708 0l4.5-4.5a.5.5 0 0 0-.708-.708L7.5 10.293 4.303 7.096a.5.5 0 0 0-.707.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.keyword-pattern-row[data-pattern-type="startsWith"] input.pattern-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M12.136.326A1.5 1.5 0 0 1 14 1.78V3h.5A1.5 1.5 0 0 1 16 4.5v9a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 0 13.5v-9a1.5 1.5 0 0 1 1.432-1.499L12.136.326zM2 3h12v1.5a.5.5 0 0 1-.5.5h-12a.5.5 0 0 1-.5-.5V3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.keyword-pattern-row[data-pattern-type="endsWith"] input.pattern-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M1.293 1.293a1 1 0 0 1 1.414 0L8 6.586l5.293-5.293a1 1 0 1 1 1.414 1.414L9.414 8l5.293 5.293a1 1 0 0 1-1.414 1.414L8 9.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L6.586 8 1.293 2.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.keyword-pattern-row[data-pattern-type="exactMatch"] input.pattern-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z'/%3E%3Cpath d='M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.keyword-pattern-row[data-pattern-type="regex"] input.pattern-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z'/%3E%3Cpath d='M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0zm2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* Enhanced Custom Select Styling */
.custom-select {
  position: relative;
  width: 110px;
  flex-shrink: 0;
  margin-right: 5px;
  height: 34px !important;
}

.custom-select::before {
  content: "Route to:";
  position: absolute;
  left: 0;
  bottom: 38px;
  font-size: 10px;
  color: rgba(167, 139, 250, 0.8);
  font-weight: 500;
  padding: 0 2px;
  background-color: rgba(30, 30, 30, 0.95);
  border-radius: 2px;
}

.selected-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #a78bfa;
  font-weight: 500;
  border-radius: 6px;
  padding: 4px 10px;
  height: 34px !important;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  user-select: none;
  position: relative;
  overflow: hidden;
  font-size: 13px;
}

.selected-option::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(139, 92, 246, 0.05), transparent);
  pointer-events: none;
}

.selected-option:hover {
  background-color: rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}

.selected-option span {
  font-weight: 600;
  position: relative;
}

.selected-option span::before {
  content: "▾";
  position: absolute;
  right: -18px;
  top: 0;
  font-size: 14px;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.selected-option:hover span::before {
  transform: translateY(3px);
}

.selected-option i {
  font-size: 14px;
  transition: transform 0.3s ease;
  margin-left: 6px;
  color: rgba(167, 139, 250, 0.9);
}

.selected-option:hover i {
  transform: rotate(180deg);
}

/* Premium dropdown styling */
.port-select-dropdown {
  position: fixed;
  background-color: rgba(18, 18, 18, 0.95);
  border-radius: 8px;
  overflow: hidden;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(139, 92, 246, 0.4);
  backdrop-filter: blur(10px);
  min-width: 180px;
  width: auto;
  margin-top: 8px;
  animation: dropdownAppear 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.port-select-dropdown::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background-color: rgba(18, 18, 18, 0.95);
  box-shadow: -1px -1px 0 0 rgba(139, 92, 246, 0.3);
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

.port-select-dropdown::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(139, 92, 246, 0.5), transparent);
}

@keyframes dropdownAppear {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.port-select-dropdown-header {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(64, 64, 64, 0.3);
  text-align: center;
  font-weight: 600;
  background-color: rgba(139, 92, 246, 0.1);
}

.port-select-option {
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  border-left: 2px solid transparent;
  position: relative;
  font-size: 13px;
}

.port-select-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-secondary);
  text-decoration: line-through;
}

.port-select-option:not(.disabled):hover {
  background-color: rgba(139, 92, 246, 0.15);
  border-left-color: rgba(139, 92, 246, 0.5);
}

.port-select-option.selected {
  background-color: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  font-weight: 600;
  border-left-color: #8b5cf6;
  border-left-width: 3px;
  box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.1);
}

.port-select-option::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 1px;
  background-color: rgba(64, 64, 64, 0.15);
}

.port-select-option:last-child::after {
  display: none;
}

.port-select-option i {
  color: #8b5cf6;
  opacity: 0;
  transition: all 0.2s ease;
  font-size: 16px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.port-select-option.selected i {
  opacity: 1;
  color: #a78bfa;
  filter: drop-shadow(0 0 2px rgba(139, 92, 246, 0.5));
}

.port-select-option-label {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.port-select-option-label .port-name {
  font-weight: 600;
  font-size: 14px;
}

.port-select-option-label .port-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

/* Delete button styling */
.keyword-pattern-row .remove-pattern-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 16px;
}

.keyword-pattern-row .remove-pattern-btn:hover {
  background-color: rgba(239, 68, 68, 0.9);
  color: white;
  transform: scale(1.05) rotate(90deg);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

/* Add Pattern Button Styling */
#add-keyword-pattern {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: rgba(139, 92, 246, 0.1);
  color: #a78bfa;
  font-weight: 500;
  border: 1px dashed rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 16px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

#add-keyword-pattern::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(139, 92, 246, 0.05), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

#add-keyword-pattern:hover {
  background-color: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.6);
  transform: translateY(-2px);
}

#add-keyword-pattern:hover::before {
  transform: translateX(100%);
}

#add-keyword-pattern i {
  font-size: 18px;
  margin-right: 2px;
  transition: transform 0.3s ease;
}

#add-keyword-pattern:hover i {
  transform: rotate(180deg);
}

/* Patterns container styling */
#keyword-patterns-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
  padding: 20px;
  background-color: rgba(18, 18, 18, 0.3);
  border-radius: 14px;
  position: relative;
  border: 1px solid rgba(64, 64, 64, 0.2);
}

.patterns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.patterns-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: #a78bfa;
  margin: 0;
}

.patterns-header .pattern-count {
  font-size: 12px;
  color: var(--text-secondary);
  background-color: rgba(139, 92, 246, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
}

.patterns-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Router strategy section styling */
#router-strategy-container {
  position: relative;
  padding: 20px;
  background-color: rgba(18, 18, 18, 0.3);
  border-radius: 14px;
  margin-bottom: 24px;
  border: 1px solid rgba(64, 64, 64, 0.2);
}

.strategy-header {
  margin-bottom: 16px;
}

.strategy-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: #a78bfa;
  margin: 0 0 8px 0;
}

#router-strategy {
  background-color: rgba(12, 12, 12, 0.5);
  border: 1px solid rgba(64, 64, 64, 0.4);
  color: white;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  transition: all 0.25s ease;
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238b5cf6' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

#router-strategy:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3);
  outline: none;
}

#router-strategy option {
  background-color: var(--bg-darker);
  color: var(--text-primary);
  padding: 8px;
}

#router-strategy option:disabled {
  color: var(--text-secondary);
}

.strategy-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 10px;
  font-style: italic;
  line-height: 1.5;
  border-left: 2px solid rgba(139, 92, 246, 0.3);
  padding-left: 12px;
}

/* Empty state for patterns */
.empty-patterns {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-secondary);
  font-style: italic;
  background-color: rgba(12, 12, 12, 0.3);
  border-radius: 8px;
  border: 1px dashed rgba(64, 64, 64, 0.3);
}

.empty-patterns i {
  font-size: 24px;
  margin-bottom: 8px;
  color: rgba(139, 92, 246, 0.4);
}

/* Hide real select element but keep it for form submission */
.port-select {
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

.keyword-pattern-row .remove-pattern-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.keyword-pattern-row .remove-pattern-btn:hover {
  background-color: var(--danger);
  color: white;
  transform: scale(1.05);
}

#add-keyword-pattern {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
  font-weight: 500;
  border: 1px dashed rgba(139, 92, 246, 0.5);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 16px;
  width: 100%;
}

#add-keyword-pattern:hover {
  background-color: rgba(139, 92, 246, 0.2);
  transform: scale(1.01);
}

#add-keyword-pattern i {
  font-size: 16px;
  margin-right: 2px;
}

#keyword-patterns-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  border-radius: 12px;
  padding: 16px;
  background-color: rgba(38, 38, 38, 0.4);
  border: 1px solid var(--border);
  position: relative;
}

.strategy-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-style: italic;
  padding-left: 2px;
  opacity: 0.8;
}

/* Add a slight highlight around the router configuration section */
#router-config {
  position: relative;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px dashed var(--border);
}

#router-strategy-container {
  position: relative;
  padding: 16px;
  background-color: rgba(139, 92, 246, 0.08);
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

#router-strategy-container::before {
  content: "Router Configuration";
  position: absolute;
  top: -10px;
  left: 12px;
  background-color: var(--bg-lighter);
  padding: 0 8px;
  font-size: 12px;
  color: #8b5cf6;
  font-weight: 600;
}

/* Make keyword pattern inputs more readable */
.keyword-pattern-row input {
  font-family: 'Roboto Mono', monospace;
  letter-spacing: 0.03em;
}

/* Completely remove all custom styling for nodes that need configuration */
/* Let's rely only on the badge instead of modifying the node itself */

@keyframes pulse {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* Badge for not configured nodes - more prominent but no node distortion */
.not-configured-badge {
  background-color: var(--danger) !important;
  color: white !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  display: inline-block !important;
  letter-spacing: 0.01em !important;
  /* Make sure it doesn't exceed its container */
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Shake animation for unconfigured nodes */
.shake-animation {
  animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both;
  transform: translate3d(0, 0, 0);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}
}